<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>煤炭江湖 | 新概念书签空间</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        :root {
            --glass-blur: 12px;
            --glass-border: 1px solid rgba(255, 255, 255, 0.2);
            --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            --glass-bg: rgba(255, 255, 255, 0.85);
            --primary-accent: #6C5CE7;
            --text-primary: #2D3436;
            --text-secondary: #636E72;
            --highlight: #00CEFF;
        }
        
        body {
            font-family: 'Noto Sans SC', sans-serif;
            background: linear-gradient(135deg, #E0F7FA 0%, #B2EBF2 50%, #80DEEA 100%);
            min-height: 100vh;
            padding: 0;
            margin: 0;
            color: var(--text-primary);
            overflow-x: hidden;
        }
        
        .container-fluid {
            padding: 0 5%;
        }
        
        /* 大标题样式 */
        .floating-header {
            position: relative;
            padding: 80px 0 50px;
            text-align: left;
            margin-left: -5%;
        }
        
        .floating-header h1 {
            font-weight: 700;
            font-size: 4rem;
            margin: 0;
            background: linear-gradient(90deg, var(--primary-accent), var(--highlight));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            display: inline-block;
            transform: rotate(-3deg);
            text-shadow: 4px 4px 10px rgba(0, 0, 0, 0.05);
        }
        
        .floating-header .subtitle {
            font-size: 1.5rem;
            color: var(--text-secondary);
            margin-top: 20px;
            transform: rotate(-1deg);
            max-width: 600px;
            line-height: 1.6;
            font-weight: 400;
        }
        
        /* 玻璃卡片样式 */
        .glass-card {
            background: var(--glass-bg);
            backdrop-filter: blur(var(--glass-blur));
            -webkit-backdrop-filter: blur(var(--glass-blur));
            border-radius: 16px;
            border: var(--glass-border);
            box-shadow: var(--glass-shadow);
            transition: all 0.3s ease;
            overflow: hidden;
            color: var(--text-primary);
        }
        
        /* 控制面板 */
        .control-panel {
            position: fixed;
            bottom: 30px;
            right: 30px;
            z-index: 100;
            display: flex;
            flex-direction: column;
            gap: 15px;
        }
        
        .control-btn {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--glass-bg);
            backdrop-filter: blur(var(--glass-blur));
            border: var(--glass-border);
            box-shadow: var(--glass-shadow);
            color: var(--primary-accent);
            font-size: 24px;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .control-btn:hover {
            transform: translateY(-5px) scale(1.1);
            background: rgba(255, 255, 255, 0.95);
        }
        
        .control-btn.add-btn {
            background: linear-gradient(135deg, var(--primary-accent), var(--highlight));
            color: white;
        }
        
        /* 搜索区域 */
        .search-section {
            position: relative;
            margin: 0 0 50px;
            display: flex;
            gap: 25px;
            flex-wrap: wrap;
        }
        
        .search-panel {
            flex: 1;
            min-width: 300px;
            padding: 30px;
        }
        
        .search-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 20px;
            font-weight: 500;
            color: var(--text-primary);
            font-size: 1.3rem;
        }
        
        .search-form {
            display: flex;
            height: 55px;
            border-radius: 12px;
            overflow: hidden;
        }
        
        .search-input {
            flex: 1;
            padding: 0 25px;
            border: none;
            background: rgba(255, 255, 255, 0.95);
            font-size: 1.1rem;
            outline: none;
            color: var(--text-primary);
        }
        
        .search-btn {
            padding: 0 30px;
            border: none;
            background: var(--primary-accent);
            color: white;
            cursor: pointer;
            font-weight: 500;
            font-size: 1.1rem;
            transition: all 0.2s;
        }
        
        /* 标签云 */
        .tag-cloud {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            margin: 35px 0;
        }
        
        .tag {
            padding: 10px 25px;
            border-radius: 50px;
            background: rgba(108, 92, 231, 0.1);
            color: var(--primary-accent);
            font-size: 1rem;
            cursor: pointer;
            transition: all 0.2s;
            border: 1px solid rgba(108,92,231,0.2);
        }
        
        .tag:hover, .tag.active {
            background: var(--primary-accent);
            color: white;
            transform: translateY(-3px);
        }
        
        /* 书签卡片 - 优化版 */
        .bookmarks-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 30px;
            margin: 50px 0;
        }
        
        .bookmark-card {
            position: relative;
            height: 240px;
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
        }
        
        .bookmark-card:hover {
            transform: translateY(-10px) scale(1.03);
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
        }
        
        .card-content {
            position: relative;
            height: 100%;
            padding: 30px;
            display: flex;
            flex-direction: column;
        }
        
        .favicon {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 25px;
            overflow: hidden;
        }
        
        .favicon img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .card-title {
            font-size: 1.4rem;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 12px;
            line-height: 1.3;
        }
        
        .card-title a {
            color: inherit;
            text-decoration: none;
            transition: color 0.2s;
        }
        
        .card-title a:hover {
            color: var(--primary-accent);
        }
        
        .card-url {
            color: var(--text-secondary);
            font-size: 0.95rem;
            margin-bottom: 18px;
            display: block;
            text-decoration: none;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        
        .card-description {
            color: var(--text-secondary);
            line-height: 1.6;
            margin-bottom: 20px;
            font-size: 1rem;
            flex-grow: 1;
        }
        
        .card-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }
        
        .card-tag {
            font-size: 0.85rem;
            padding: 5px 15px;
            border-radius: 50px;
            background: rgba(108, 92, 231, 0.1);
            color: var(--primary-accent);
            font-weight: 500;
            border: 1px solid rgba(108,92,231,0.1);
        }
        
        /* 动态背景元素 */
        .bg-elements {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: -1;
            overflow: hidden;
        }
        
        .bg-element {
            position: absolute;
            border-radius: 50%;
            filter: blur(60px);
            opacity: 0.15;
        }
        
        .bg-element-1 {
            width: 300px;
            height: 300px;
            background: var(--primary-accent);
            top: 20%;
            left: 10%;
            animation: float 15s infinite alternate ease-in-out;
        }
        
        .bg-element-2 {
            width: 400px;
            height: 400px;
            background: var(--highlight);
            bottom: 10%;
            right: 15%;
            animation: float 18s infinite alternate-reverse ease-in-out;
        }
        
        @keyframes float {
            0% { transform: translate(0, 0) rotate(0deg); }
            50% { transform: translate(50px, 50px) rotate(180deg); }
            100% { transform: translate(0, 0) rotate(360deg); }
        }
        
        /* JSON编辑器模态框 */
        .json-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(10px);
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }
        
        .json-modal.active {
            opacity: 1;
            visibility: visible;
        }
        
        .json-editor {
            width: 80%;
            max-width: 900px;
            max-height: 80vh;
            padding: 40px;
            border-radius: 20px;
            background: rgba(255, 255, 255, 0.95);
            box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
            position: relative;
        }
        
        .close-modal {
            position: absolute;
            top: 25px;
            right: 25px;
            width: 45px;
            height: 45px;
            border-radius: 50%;
            background: rgba(0, 0, 0, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
            color: var(--text-primary);
        }
        
        .close-modal:hover {
            background: rgba(0, 0, 0, 0.2);
            transform: rotate(90deg);
        }
        
        .json-textarea {
            width: 100%;
            height: 60vh;
            padding: 25px;
            border-radius: 12px;
            border: 1px solid rgba(0,0,0,0.1);
            font-family: 'Courier New', monospace;
            font-size: 15px;
            resize: none;
            background: rgba(0,0,0,0.03);
            margin-bottom: 25px;
            line-height: 1.6;
            color: var(--text-primary);
        }
        
        .json-actions {
            display: flex;
            justify-content: center;
            gap: 20px;
        }
        
        .json-btn {
            padding: 15px 35px;
            border-radius: 50px;
            border: none;
            background: var(--primary-accent);
            color: white;
            cursor: pointer;
            transition: all 0.2s;
            font-weight: 500;
            font-size: 1.1rem;
        }
        
        .json-btn:hover {
            background: #5649C2;
            transform: translateY(-3px);
        }
        
        .json-btn.load {
            background: var(--highlight);
        }
        
        /* 空状态提示 */
        .empty-state {
            grid-column: 1/-1;
            padding: 60px;
            text-align: center;
            color: var(--text-secondary);
        }
        
        /* 新增的时间天气样式 */
        .time-weather-container {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 50;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        .time-display {
            background: var(--glass-bg);
            backdrop-filter: blur(var(--glass-blur));
            -webkit-backdrop-filter: blur(var(--glass-blur));
            border-radius: 12px;
            border: var(--glass-border);
            box-shadow: var(--glass-shadow);
            padding: 15px 25px;
            text-align: center;
            min-width: 180px;
        }
        
        .time-display .time {
            font-size: 1.8rem;
            font-weight: 600;
            color: var(--primary-accent);
            line-height: 1;
        }
        
        .time-display .date {
            font-size: 0.9rem;
            color: var(--text-secondary);
            margin-top: 5px;
        }
        
        .weather-display {
            background: var(--glass-bg);
            backdrop-filter: blur(var(--glass-blur));
            -webkit-backdrop-filter: blur(var(--glass-blur));
            border-radius: 12px;
            border: var(--glass-border);
            box-shadow: var(--glass-shadow);
            padding: 15px 25px;
            display: flex;
            align-items: center;
            gap: 15px;
        }
        
        .weather-icon {
            width: 50px;
            height: 50px;
        }
        
        .weather-info {
            flex: 1;
        }
        
        .weather-temp {
            font-size: 1.5rem;
            font-weight: 600;
            color: var(--primary-accent);
            line-height: 1;
        }
        
        .weather-desc {
            font-size: 0.9rem;
            color: var(--text-secondary);
            margin-top: 3px;
        }
        
        .weather-location {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-top: 5px;
        }
        
        /* 响应式设计 */
        @media (max-width: 768px) {
            .floating-header {
                padding: 60px 0 40px;
                margin-left: 0;
            }
            
            .floating-header h1 {
                font-size: 2.8rem;
            }
            
            .floating-header .subtitle {
                font-size: 1.3rem;
            }
            
            .search-section {
                flex-direction: column;
                gap: 15px;
            }
            
            .search-panel {
                min-width: 100%;
                padding: 25px;
            }
            
            .bookmarks-grid {
                grid-template-columns: 1fr;
                gap: 20px;
            }
            
            .control-panel {
                bottom: 20px;
                right: 20px;
            }
            
            .json-editor {
                width: 90%;
                padding: 30px;
            }
            
            .json-actions {
                flex-direction: column;
                gap: 15px;
            }
            
            .json-btn {
                width: 100%;
            }
            
            .time-weather-container {
                top: 10px;
                right: 10px;
            }
            
            .time-display, .weather-display {
                padding: 12px 15px;
            }
            
            .time-display .time {
                font-size: 1.5rem;
            }
        }
    </style>
</head>
<body>
    <!-- 动态背景元素 -->
    <div class="bg-elements">
        <div class="bg-element bg-element-1"></div>
        <div class="bg-element bg-element-2"></div>
    </div>
    
    <!-- 新增的时间天气显示 -->
    <div class="time-weather-container">
        <div class="time-display glass-card">
            <div class="time" id="current-time">00:00:00</div>
            <div class="date" id="current-date">2023年1月1日 星期一</div>
        </div>
        <div class="weather-display glass-card" id="weather-display">
            <img class="weather-icon" id="weather-icon" src="https://img.icons8.com/ios/50/000000/partly-cloudy-day--v1.png" alt="天气图标">
            <div class="weather-info">
                <div class="weather-temp" id="weather-temp">--°C</div>
                <div class="weather-desc" id="weather-desc">加载中...</div>
                <div class="weather-location">
                    <span class="glyphicon glyphicon-map-marker"></span>
                    <span id="weather-location">北京</span>
                </div>
            </div>
        </div>
    </div>
    
    <div class="container-fluid">
        <!-- 大标题 -->
        <div class="floating-header">
            <h1>煤炭江湖</h1>
            <p class="subtitle">您的专属数字空间 · 链接一切可能</p>
        </div>
        
        <!-- 搜索区域 -->
        <div class="search-section">
            <!-- 搜索书签 -->
            <div class="glass-card search-panel">
                <div class="search-header">
                    <span class="glyphicon glyphicon-search"></span>
                    <span>探索您的书签</span>
                </div>
                <form class="search-form" id="search-bookmark-form">
                    <input type="text" class="search-input" id="search-input" placeholder="输入关键词...">
                    <button type="submit" class="search-btn">
                        <span class="glyphicon glyphicon-chevron-right"></span>
                    </button>
                </form>
            </div>
            
            <!-- 百度搜索 -->
            <div class="glass-card search-panel">
                <div class="search-header">
                    <span class="glyphicon glyphicon-globe"></span>
                    <span>连接互联网</span>
                </div>
                <form class="search-form" id="baidu-search-form">
                    <input type="text" class="search-input" id="baidu-search-input" placeholder="百度搜索...">
                    <button type="submit" class="search-btn">
                        <span class="glyphicon glyphicon-chevron-right"></span>
                    </button>
                </form>
            </div>
        </div>
        
        <!-- 标签云 -->
        <div class="tag-cloud" id="filter-tags">
            <div class="tag active">全部</div>
            <div class="tag">办公</div>
            <div class="tag">工具</div>
            <div class="tag">娱乐</div>
            <div class="tag">其他</div>
        </div>
        
        <!-- 书签网格 -->
        <div class="bookmarks-grid" id="bookmarks-grid">
            <!-- 书签卡片将通过JavaScript动态生成 -->
        </div>
    </div>
    
    <!-- 浮动控制面板 -->
    <div class="control-panel">
        <button class="control-btn json-btn" id="json-editor-btn">
            <span class="glyphicon glyphicon-cog"></span>
        </button>
        <button class="control-btn add-btn" id="add-bookmark-btn">
            <span class="glyphicon glyphicon-plus"></span>
        </button>
    </div>
    
    <!-- JSON编辑器模态框 -->
    <div class="json-modal" id="json-modal">
        <div class="json-editor glass-card">
            <div class="close-modal" id="close-modal">
                <span class="glyphicon glyphicon-remove"></span>
            </div>
            <h2 class="text-center" style="font-size: 1.8rem; margin-bottom: 30px;">书签数据编辑器</h2>
            <textarea class="json-textarea" id="json-data" spellcheck="false"></textarea>
            <div class="json-actions">
                <button class="json-btn load" id="load-json-btn">
                    <span class="glyphicon glyphicon-refresh"></span> 加载数据
                </button>
                <button class="json-btn" id="export-json-btn">
                    <span class="glyphicon glyphicon-download"></span> 导出数据
                </button>
            </div>
        </div>
    </div>

    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script>
        // 书签数据
        let bookmarks = [
            {
                "id": 1,
                "title": "国能4A登陆网址",
                "url": "https://www.chnenergy.com.cn/",
                "favicon": "https://img.icons8.com/office/40/000000/office.png",
                "description": "国家能源集团官方网站",
                "tags": [
                    "办公"
                ],
                "category": "office"
            },
            {
                "id": 2,
                "title": "国能云文档",
                "url": "https://wpsyun.ceic.com/kdrive/ent/1/89082",
                "favicon": "https://img.icons8.com/office/40/000000/cloud.png",
                "description": "云文档协作平台",
                "tags": [
                    "办公"
                ],
                "category": "office"
            },
            {
                "id": 3,
                "title": "工包填报",
                "url": "http://jingying.chnenergy.com.cn:8081/index/login",
                "favicon": "https://img.icons8.com/office/40/000000/edit-file.png",
                "description": "工作包填报系统",
                "tags": [
                    "办公"
                ],
                "category": "office"
            },
            {
                "id": 4,
                "title": "扣子",
                "url": "https://www.coze.cn/home",
                "favicon": "https://img.icons8.com/office/40/000000/robot.png",
                "description": "AI助手平台",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            },
            {
                "id": 5,
                "title": "DeepSeek",
                "url": "https://chat.deepseek.com/",
                "favicon": "https://img.icons8.com/office/40/000000/ai.png",
                "description": "AI对话工具",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            },
            {
                "id": 6,
                "title": "新疆销售系统",
                "url": "https://xjcoalmanage.ceic.com/index/newLogin",
                "favicon": "https://img.icons8.com/office/40/000000/sales-performance.png",
                "description": "新疆销售管理系统",
                "tags": [
                    "办公"
                ],
                "category": "office"
            },
            {
                "id": 7,
                "title": "新疆销售测试",
                "url": "http://10.151.88.64:8888/index/newLogin",
                "favicon": "https://img.icons8.com/office/40/000000/test-passed.png",
                "description": "测试系统环境",
                "tags": [
                    "办公"
                ],
                "category": "office"
            },
            {
                "id": 8,
                "title": "云文档新疆销售",
                "url": "https://wpsyun.ceic.com/weboffice/l/tk7zyeo",
                "favicon": "https://img.icons8.com/office/40/000000/document.png",
                "description": "问题链接文档",
                "tags": [
                    "办公"
                ],
                "category": "office"
            },
            {
                "id": 9,
                "title": "飞书",
                "url": "https://acntvcya55tt.feishu.cn/drive/home/",
                "favicon": "https://img.icons8.com/office/40/000000/flying-duck.png",
                "description": "外部云文档平台",
                "tags": [
                    "工具"
                ],
                "category": "office"
            },
            {
                "id": 10,
                "title": "PDF万能",
                "url": "https://tools.pdf24.org/zh/",
                "favicon": "https://img.icons8.com/office/40/000000/pdf.png",
                "description": "PDF处理工具",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            },
            {
                "id": 11,
                "title": "飞书笔记",
                "url": "https://acntvcya55tt.feishu.cn/wiki/TKcOw9glyiITNxkcDdKcqGzznag",
                "favicon": "https://img.icons8.com/office/40/000000/note.png",
                "description": "笔记文档",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            },
            {
                "id": 12,
                "title": "百度",
                "url": "https://baidu.com",
                "favicon": "https://img.icons8.com/office/40/000000/search.png",
                "description": "搜索引擎",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            },
            {
                "id": 13,
                "title": "简道云低代码",
                "url": "https://www.jiandaoyun.com/dashboard#/",
                "favicon": "https://img.icons8.com/office/40/000000/low-code.png",
                "description": "低代码开发平台",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            },
            {
                "id": 14,
                "title": "腾讯微搭",
                "url": "https://tcb.cloud.tencent.com/dev?envId=cloud1-3g4rr6wd495f7437#/overview",
                "favicon": "https://img.icons8.com/office/40/000000/low-code.png",
                "description": "低代码平台",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            },
            {
                "id": 15,
                "title": "kimi-AI",
                "url": "https://www.kimi.com/",
                "favicon": "https://img.icons8.com/office/40/000000/ai.png",
                "description": "AI助手",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            },
            {
                "id": 16,
                "title": "抖音",
                "url": "https://www.douyin.com/",
                "favicon": "https://img.icons8.com/office/40/000000/tiktok.png",
                "description": "短视频平台",
                "tags": [
                    "娱乐"
                ],
                "category": "entertainment"
            },
            {
                "id": 17,
                "title": "AI导航网站",
                "url": "https://ai-bot.cn/",
                "favicon": "https://img.icons8.com/office/40/000000/artificial-intelligence.png",
                "description": "AI工具导航",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            },
            {
                "id": 18,
                "title": "知乎",
                "url": "https://www.zhihu.com/",
                "favicon": "https://img.icons8.com/office/40/000000/bookmark.png",
                "description": "知乎",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            },
            {
                "id": 19,
                "title": "提示词大全",
                "url": "https://www.atbigapp.com/prompt-hub/page/1?tagId=1904435086958350336",
                "favicon": "https://img.icons8.com/office/40/000000/bookmark.png",
                "description": "工具",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            },
            {
                "id": 20,
                "title": "即梦",
                "url": "https://jimeng.jianying.com/ai-tool/generate",
                "favicon": "https://img.icons8.com/office/40/000000/bookmark.png",
                "description": "AI",
                "tags": [
                    "工具"
                ],
                "category": "tool"
            }
        ];
        
        // 不同类别的图标风格
        const iconStyles = {
            office: "https://img.icons8.com/office/40/000000/",
            tool: "https://img.icons8.com/color/48/000000/",
            entertainment: "https://img.icons8.com/fluency/48/000000/"
        };
        
        // DOM元素
        const bookmarksGrid = document.getElementById('bookmarks-grid');
        const searchInput = document.getElementById('search-input');
        const filterTags = document.getElementById('filter-tags');
        const jsonModal = document.getElementById('json-modal');
        const jsonTextarea = document.getElementById('json-data');
        const loadJsonBtn = document.getElementById('load-json-btn');
        const exportJsonBtn = document.getElementById('export-json-btn');
        const addBookmarkBtn = document.getElementById('add-bookmark-btn');
        const jsonEditorBtn = document.getElementById('json-editor-btn');
        const closeModalBtn = document.getElementById('close-modal');
        const searchBookmarkForm = document.getElementById('search-bookmark-form');
        const baiduSearchForm = document.getElementById('baidu-search-form');
        const baiduSearchInput = document.getElementById('baidu-search-input');
        
        // 初始化页面
        document.addEventListener('DOMContentLoaded', function() {
            jsonTextarea.value = JSON.stringify(bookmarks, null, 2);
            renderBookmarks(bookmarks);
            
            // 标签筛选功能
            const tags = document.querySelectorAll('.tag');
            tags.forEach(tag => {
                tag.addEventListener('click', function() {
                    tags.forEach(t => t.classList.remove('active'));
                    this.classList.add('active');
                    filterBookmarks();
                });
            });
            
            // 搜索书签功能
            searchInput.addEventListener('input', filterBookmarks);
            searchBookmarkForm.addEventListener('submit', function(e) {
                e.preventDefault();
                filterBookmarks();
            });
            
            // 百度搜索功能
            baiduSearchForm.addEventListener('submit', function(e) {
                e.preventDefault();
                const query = baiduSearchInput.value.trim();
                if (query) {
                    const baiduUrl = `https://www.baidu.com/s?wd=${encodeURIComponent(query)}`;
                    window.open(baiduUrl, '_blank');
                }
            });
            
            // JSON编辑器控制
            jsonEditorBtn.addEventListener('click', function() {
                jsonModal.classList.add('active');
            });
            
            closeModalBtn.addEventListener('click', function() {
                jsonModal.classList.remove('active');
            });
            
            // 加载JSON数据
            loadJsonBtn.addEventListener('click', function() {
                try {
                    bookmarks = JSON.parse(jsonTextarea.value);
                    renderBookmarks(bookmarks);
                    filterBookmarks();
                    jsonModal.classList.remove('active');
                } catch (e) {
                    alert('JSON格式错误: ' + e.message);
                }
            });
            
            // 导出JSON数据 - 修复版
            exportJsonBtn.addEventListener('click', function() {
                const dataStr = JSON.stringify(bookmarks, null, 2);
                const dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(dataStr);
                
                const exportFileDefaultName = '煤炭江湖书签数据.json';
                
                const linkElement = document.createElement('a');
                linkElement.setAttribute('href', dataUri);
                linkElement.setAttribute('download', exportFileDefaultName);
                linkElement.click();
            });
            
            // 添加新书签
            addBookmarkBtn.addEventListener('click', function() {
                const newId = bookmarks.length > 0 ? Math.max(...bookmarks.map(b => b.id)) + 1 : 1;
                
                const newBookmark = {
                    id: newId,
                    title: "新书签",
                    url: "https://example.com",
                    favicon: "https://img.icons8.com/office/40/000000/bookmark.png",
                    description: "添加书签描述...",
                    tags: ["新标签"],
                    category: "tool"
                };
                
                bookmarks.push(newBookmark);
                renderBookmarks(bookmarks);
                filterBookmarks();
                jsonTextarea.value = JSON.stringify(bookmarks, null, 2);
            });
        });
        
        // 渲染书签卡片
        function renderBookmarks(bookmarksArray) {
            bookmarksGrid.innerHTML = '';
            
            if (bookmarksArray.length === 0) {
                bookmarksGrid.innerHTML = `
                    <div class="empty-state glass-card">
                        <span class="glyphicon glyphicon-bookmark" style="font-size: 48px; opacity: 0.5;"></span>
                        <h3 style="margin: 20px 0 10px; font-size: 1.5rem;">没有找到书签</h3>
                        <p style="font-size: 1.1rem;">尝试添加新书签或修改搜索条件</p>
                    </div>
                `;
                return;
            }
            
            bookmarksArray.forEach(bookmark => {
                const card = document.createElement('div');
                card.className = 'glass-card bookmark-card';
                
                const tagElements = bookmark.tags.map(tag => 
                    `<span class="card-tag">${tag}</span>`
                ).join('');
                
                // 根据类别选择图标风格
                const iconBase = iconStyles[bookmark.category] || iconStyles.tool;
                const iconUrl = typeof bookmark.favicon === 'string' && bookmark.favicon.startsWith('http') 
                    ? bookmark.favicon 
                    : iconBase + (bookmark.favicon || 'bookmark.png');
                
                card.innerHTML = `
                    <div class="card-content">
                        <div class="favicon">
                            <img src="${iconUrl}" alt="${bookmark.title}">
                        </div>
                        <div class="card-title">
                            <a href="${bookmark.url}" target="_blank">${bookmark.title}</a>
                        </div>
                        <a href="${bookmark.url}" target="_blank" class="card-url">${new URL(bookmark.url).hostname}</a>
                        <p class="card-description">${bookmark.description}</p>
                        <div class="card-tags">
                            ${tagElements}
                        </div>
                    </div>
                `;
                
                // 添加点击事件编辑功能
                card.addEventListener('dblclick', function() {
                    const newTitle = prompt('编辑书签标题:', bookmark.title);
                    if (newTitle !== null) bookmark.title = newTitle;
                    
                    const newUrl = prompt('编辑书签URL:', bookmark.url);
                    if (newUrl !== null) bookmark.url = newUrl;
                    
                    const newDesc = prompt('编辑书签描述:', bookmark.description);
                    if (newDesc !== null) bookmark.description = newDesc;
                    
                    const newTags = prompt('编辑标签 (用逗号分隔):', bookmark.tags.join(','));
                    if (newTags !== null) bookmark.tags = newTags.split(',').map(t => t.trim());
                    
                    const newCategory = prompt('编辑类别 (office/tool/entertainment):', bookmark.category);
                    if (newCategory !== null) bookmark.category = newCategory;
                    
                    renderBookmarks(bookmarks);
                    filterBookmarks();
                    jsonTextarea.value = JSON.stringify(bookmarks, null, 2);
                });
                
                bookmarksGrid.appendChild(card);
            });
        }
        
        // 筛选书签
        function filterBookmarks() {
            const searchTerm = searchInput.value.toLowerCase();
            const activeTag = document.querySelector('.tag.active').textContent;
            
            const filtered = bookmarks.filter(bookmark => {
                const matchesSearch = 
                    bookmark.title.toLowerCase().includes(searchTerm) ||
                    (bookmark.description && bookmark.description.toLowerCase().includes(searchTerm)) ||
                    bookmark.tags.some(tag => tag.toLowerCase().includes(searchTerm));
                
                const matchesTag = activeTag === '全部' || 
                    bookmark.tags.some(tag => tag === activeTag);
                
                return matchesSearch && matchesTag;
            });
            
            renderBookmarks(filtered);
        }
        
        // 更新时间函数
        function updateTime() {
            const now = new Date();
            const timeElement = document.getElementById('current-time');
            const dateElement = document.getElementById('current-date');
            
            // 格式化时间
            const hours = now.getHours().toString().padStart(2, '0');
            const minutes = now.getMinutes().toString().padStart(2, '0');
            const seconds = now.getSeconds().toString().padStart(2, '0');
            timeElement.textContent = `${hours}:${minutes}:${seconds}`;
            
            // 格式化日期
            const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
            const year = now.getFullYear();
            const month = (now.getMonth() + 1).toString().padStart(2, '0');
            const day = now.getDate().toString().padStart(2, '0');
            const weekday = weekdays[now.getDay()];
            dateElement.textContent = `${year}年${month}月${day}日 ${weekday}`;
        }
        
        // 初始化时间并设置定时器
        updateTime();
        setInterval(updateTime, 1000);
        
        // 获取天气数据
        async function fetchWeather(city = '北京') {
            try {
                // 使用和风天气API (需要替换为您自己的API key)
                const apiKey = 'YOUR_API_KEY'; // 替换为实际API key
                const response = await fetch(`https://devapi.qweather.com/v7/weather/now?location=101010100&key=${apiKey}`);
                
                if (!response.ok) {
                    throw new Error('天气数据获取失败');
                }
                
                const data = await response.json();
                
                // 更新天气信息
                document.getElementById('weather-temp').textContent = `${data.now.temp}°C`;
                document.getElementById('weather-desc').textContent = data.now.text;
                
                // 根据天气状况更新图标 (这里使用简单的映射)
                const weatherIcon = document.getElementById('weather-icon');
                const weatherCode = data.now.icon;
                
                // 简单天气图标映射
                const iconMap = {
                    '100': 'sunny',      // 晴
                    '101': 'cloud',       // 多云
                    '102': 'cloud',       // 少云
                    '103': 'cloudy',      // 阴
                    '104': 'cloudy',      // 阴
                    '300': 'rain',        // 雨
                    '400': 'snow',        // 雪
                };
                
                const defaultIcon = 'partly-cloudy-day';
                const iconType = iconMap[weatherCode] || defaultIcon;
                weatherIcon.src = `https://img.icons8.com/ios/50/000000/${iconType}--v1.png`;
                
            } catch (error) {
                console.error('获取天气数据出错:', error);
                document.getElementById('weather-temp').textContent = '--°C';
                document.getElementById('weather-desc').textContent = '天气数据获取失败';
            }
        }
        
        // 获取用户位置并更新天气
        function getLocationAndWeather() {
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(
                    async (position) => {
                        try {
                            const { latitude, longitude } = position.coords;
                            const apiKey = 'YOUR_API_KEY'; // 替换为实际API key
                            
                            // 获取城市信息
                            const locationResponse = await fetch(`https://geoapi.qweather.com/v2/city/lookup?location=${longitude},${latitude}&key=${apiKey}`);
                            const locationData = await locationResponse.json();
                            
                            if (locationData.location && locationData.location.length > 0) {
                                const city = locationData.location[0].name;
                                document.getElementById('weather-location').textContent = city;
                                
                                // 获取天气信息
                                const weatherResponse = await fetch(`https://devapi.qweather.com/v7/weather/now?location=${locationData.location[0].id}&key=${apiKey}`);
                                const weatherData = await weatherResponse.json();
                                
                                document.getElementById('weather-temp').textContent = `${weatherData.now.temp}°C`;
                                document.getElementById('weather-desc').textContent = weatherData.now.text;
                            }
                        } catch (error) {
                            console.error('获取位置或天气数据出错:', error);
                            // 使用默认城市
                            fetchWeather();
                        }
                    },
                    (error) => {
                        console.error('获取位置失败:', error);
                        // 使用默认城市
                        fetchWeather();
                    }
                );
            } else {
                // 浏览器不支持地理位置，使用默认城市
                fetchWeather();
            }
        }
        
        // 初始化天气
        document.addEventListener('DOMContentLoaded', function() {
            getLocationAndWeather();
        });
    </script>
</body>
</html>